// https://www.acwing.com/problem/content/789/

#include <iostream>
#include <vector>

using namespace std;

void merge(vector<int>& nums, const int left, const int mid, const int right) {
    int n1 = mid - left + 1;
    int n2 = right - mid;
    // 创建临时数组
    vector<int> left_arr(n1);
    vector<int> right_arr(n2);

    // 复制数据到临时数组
    for (int i=0; i<n1; i++) {
        left_arr[i] = nums[left + i];
    }
    for (int i=0; i<n2; i++) {
        right_arr[i] = nums[mid + 1 + i];
    }

    // 合并临时数组
    int i = 0; // 左半部分的索引
    int j = 0; // 右半部分的索引
    int k = left; // 合并后数组的索引

    while (i < n1 && j < n2) {
        if (left_arr[i] < right_arr[j]) {
            nums[k] = left_arr[i];
            i++;
        } else {
            nums[k] = right_arr[j];
            j++;
        }
        k++;
    }

    while (i < n1) {
        nums[k] = left_arr[i];
        i++;
        k++;
    }
    while (j < n2) {
        nums[k] = right_arr[j];
        j++;
        k++;
    }
}

void merge_sort(vector<int>& nums, const int left, const int right) {
    if (left < right) {
        // 找到中间索引
        int mid = left + (right - left) / 2;

        // 分别对左右两半进行排序
        merge_sort(nums, left, mid);
        merge_sort(nums, mid+1, right);

        // 合并已排序的两半
        merge(nums, left, mid, right);
    }
}

void merge_sort(vector<int>& nums) {
    merge_sort(nums, 0, (int) nums.size()-1);
}

int main() {
    int n;
    cin>>n;
    vector<int> nums(n);
    for(int i=0; i<n; i++) {
        cin>>nums[i];
    }
    merge_sort(nums);
    for(int i=0; i<n-1; i++) {
        cout<<nums[i]<<" ";
    }
    cout<<nums[n-1]<<endl;
    return 0;
}

